{% extends 'index.html' %}
{% block content %}
    <div class="container">
        <div style="margin-bottom: 20px">
            <a class="btn btn-success" href="/pretty/add">
                <span class="glyphicon glyphicon-plus-sign" aria-hidden="true"> </span>
                新建靓号</a>

        </div>

        <div style="float: right;width: 300px;margin: 5px">  <!-- 搜索框宽300，右飘 -->
            <form method="get">  <!-- 表单提交 -->
                {% csrf_token %}
                <div class="input-group">  <!-- name属性="q" -->
                    <input type="text" name="q" class="form-control" placeholder="搜索手机号码..."
                           value="{{ search_data }}">
                    <span class="input-group-btn">
                        <button class="btn btn-default" type="submit">
                            <span class="glyphicon glyphicon-search" aria-hidden="true"></span>  <!-- 加个图标 -->
                        </button>
                      </span>
                </div>
            </form>
        </div>


        <div class="panel panel-default">
            <!-- Default panel contents -->
            <div class="panel-heading">
                <span class="glyphicon glyphicon-th-list" aria-hidden="true"> </span>
                靓号列表
            </div>

            <!-- Table -->
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>号码</th>
                    <th>价格</th>
                    <th>级别</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                {% for item in queryset %}
                    <tr>
                        <th>{{ item.id }}</th>
                        <th>{{ item.mobile }}</th>
                        <th>{{ item.price }}</th>
                        <th>{{ item.get_level_display }}</th>
                        <th>{{ item.get_status_display }}</th>
                        <td>
                            <a class="btn btn-primary btn-xs" href="/pretty/{{ item.id }}/edit/">编辑</a>
                            {#                            <a class="btn btn-danger btn-xs" href="{% url 'user_del' %}?id={{ item.id }}">删除</a>#}
                            <a class="btn btn-danger btn-xs" href="/pretty/{{ item.id }}/del/">删除</a>
                        </td>
                    </tr>
                {% endfor %}

                </tbody>
            </table>
        </div>

        <ul class="pagination">
            {{ page_string }}

            <li style="margin-left: 15px">

                <form method="get" style="float: left;margin-left: -1px">
                    <div class="input-group" style="width: 100px">
                        <input type="text" name="page"
                               style="position: relative;float: left;display: inline-block;width:100px;border-radius: 0"
                               class="form-control" placeholder="页码">
                        <span class="input-group-btn">
                    <button style="border-radius: 0" class="btn btn-default" type="submit">跳转</button>
                </span>
                    </div>

                </form>
            </li>
        </ul>
    </div>
{% endblock %}